//
//  Custom6TableViewCell.m
//  UI---8.9--婚礼记
//
//  Created by 北风 on 14-10-5.
//  Copyright (c) 2014年 高敬轩. All rights reserved.
//

#import "Custom6TableViewCell.h"
#import "CustomCollectionViewCell.h"
#import "UIButton+WebCache.h"

@implementation Custom6TableViewCell
- (void)dealloc
{
    [_icon release];
    [_tags release];
    [super dealloc];
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.iconArray = [[NSMutableArray alloc] init];
        [self.iconArray addObject:@"张一凡"];
        [self.iconArray addObject:@"李洪庆"];
        [self.iconArray addObject:@"张欣"];
        [self.iconArray addObject:@"林冠成"];
        [self.iconArray addObject:@"王博"];
        [self.iconArray addObject:@"周鹰"];
        // Initialization code
        UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
        [flowLayout setScrollDirection:UICollectionViewScrollDirectionVertical];
        UICollectionView *collect = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 5, 310, 210) collectionViewLayout:flowLayout];
        collect.backgroundColor = [UIColor whiteColor];
        flowLayout.itemSize = CGSizeMake(95, 95);
//        flowLayout.minimumInteritemSpacing = 40;
//        flowLayout.minimumLineSpacing = 40;
        [collect setDataSource:self];
        [collect setDelegate:self];
        //注册一个类
        [collect  registerClass:[CustomCollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
        [self.contentView addSubview:collect];
        [collect release];
        
        
    }
    return self;
}


-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    
    
    return 6;
}

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    CustomCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    
   [cell.button1 setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg",indexPath.item + 1]]];
    [cell.small1 setText:[_iconArray objectAtIndex:indexPath.item]];
    return cell;
    
}

-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPaths{
    
    CommentViewController *comment = [[CommentViewController alloc] init];
  [self.delegate pushViewController:comment];
    [comment release];
    
}



- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
